<%@page language="Java" contentType="text/html; UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="ssi.tools.Connector" %>

<%
	Connection connection = new Connector().getConnection();
	Statement statement = connection.createStatement();
	ResultSet result = statement.executeQuery("SELECT id, breed, name FROM animals");
	int numberOfRows = Connector.getRowCount(result);
%>



<h2>Dodaj ogłoszenie:</h2>
<html:form action="addAd"  enctype="multipart/form-data">
<p class="center">Zwierzak, którego dotyczy ogłoszenie: <select name="animal_choice" id="animal"> 
<option value="0">Wybierz... </option>
<%
int i=0;
while(result.next()){%>
<option value="<%=result.getString("id") %>"><%=result.getString("name")+" "+result.getString("breed") %></option>
<% 
} %>
</select> <br>Jeżeli nie ma takiego zwierzaka <a class="menu" href="index.jsp?page=adAnimal">DODAJ GO</a><br>
<p>Tytul: <input type="text" name="title" id="title"/><br>
<p>Tresc:<br>

<textarea name="ad" id="ad" rows="10" cols="50"></textarea><br>
<html:file property="file" size="50" /> 
<input type="submit" class="submit" value="Dodaj"/>
<font color="red"><html:errors property="error" /></font>
</html:form>

